<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" href="http://www.petercorke.com/RVC/common/toolboxhelp.css">
    <title>M-File Help: ilabel</title>
  </head>
  <body>
  <table border="0" cellspacing="0" width="100%">
    <tr class="subheader">
      <td class="headertitle">M-File Help: ilabel</td>
      <td class="subheader-left"><a href="matlab:open ilabel">View code for ilabel</a></td>
    </tr>
  </table>
<h1>ilabel</h1><p><span class="helptopic">Label an image</span></p><strong>L</strong> = <span style="color:red>ilabel</span>(<strong>im</strong>) performs connectivity analysis on the image <strong>im</strong> and returns a
label image <strong>L</strong>, same size as <strong>im</strong>, where each pixel value represents the integer
region label assigned to the corresponding pixel in <strong>im</strong>.  Region labels are in
the range 1 to M.

[<strong>L</strong>,<strong>m</strong>] = <span style="color:red>ilabel</span>(<strong>im</strong>) as above but returns the value of the maximum
label value.

[<strong>L</strong>,<strong>m</strong>,<strong>parents</strong>] = <span style="color:red>ilabel</span>(<strong>im</strong>) as above but also returns region hierarchy
information.  The value of <strong>parents</strong>(I) is the label of the parent or
enclosing	region of region I.  A value of 0 indicates that the region has
no single enclosing region, for a binary image this means the region
touches the edge of the image, for a multilevel image it means that it
touches more than one other region.

[<strong>L</strong>,<strong>maxlabel</strong>,<strong>parents</strong>,<strong>class</strong>] = <span style="color:red>ilabel</span>(<strong>im</strong>) as above but also returns the class
of pixels within each region.  The value of <strong>class</strong>(I) is the value of the
pixels that comprise region I.

[<strong>L</strong>,<strong>maxlabel</strong>,<strong>parents</strong>,<strong>class</strong>,<strong>edge</strong>] = <span style="color:red>ilabel</span>(<strong>im</strong>) as above but also returns the
edge-touch status of each region.  If <strong>edge</strong>(I) is 1 then region I touches
edge of the image, otherwise it does not.

<h2>Notes</h2>
<ul>
  <li>Is a MEX file.</li>
  <li>The image can be binary or multi-level</li>
  <li>Connectivity is performed using 4 nearest neighbours by default. To use
8-way connectivity pass a second argument of 8, eg. ILABEL(IM, 8).</li>
  <li>This is a "low level" function, IBLOBS is a higher level interface.</li>
  <li>Connectivity is only performed within a 2D image.</li>
</ul>
<h2>See also</h2>
<p>
<a href="matlab:doc iblobs">iblobs</a>, <a href="matlab:doc imoments">imoments</a></p>
<hr>

<table border="0" width="100%" cellpadding="0" cellspacing="0">
  <tr class="subheader" valign="top"><td>&nbsp;</td></tr></table>
<p class="copy">&copy; 1990-2011 Peter Corke.</p>
</body></html>